@file:Suppress("RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS")

package com.termux.utils

object LibUtil {
    private const val libPaths = "java.library.path"
    fun addLibraryDir(path: String?) {
        try {
            System.setProperty(
                libPaths,System.getProperty(
                    libPaths
                ) + ":$path")
            val field =
                ClassLoader::class.java.getDeclaredField("sys_paths")
            field.isAccessible = true
            field.set(null, null)
        } catch (e: NoSuchFieldException) {
            e.printStackTrace()
        } catch (e: IllegalAccessException) {
            e.printStackTrace()
        }
    }
}